﻿namespace Borg.AttributeAnalyze.Result
{
    public class DuplicatedParameterValue : ResultBase
    {
        private readonly ParamValue _parameterValue;
        private readonly PlugTypeInfo _plug;

        public DuplicatedParameterValue(PlugTypeInfo plug, ParamValue parameterValue)
            : base(plug.Assembly, Component.Plug, ResultType.DuplicatedParameterValue, plug, plug.extensionTypeInfo)
        {
            _plug = plug;
            _parameterValue = parameterValue;
        }

        public override string ToMsBuildMessageString()
        {
            return string.Format(
                "parametervalue is multiple times assigned\n{0}slot name: {1}\n{0}class:" +
                " {2}\n{0}parameter name: {3}\n{0}parameter value: {4}",
                new[] { GetWhiteSpace(2), Name, TypeName, _parameterValue.Name, _parameterValue.Value });
        }

        public override MessageType MessageType
        {
            get { return MessageType.Error; }
        }
    }
}

